package com.tongyi.lizhishop.common;

import android.app.Activity;
import android.content.pm.ActivityInfo;

import com.tongyi.lizhishop.R;
import com.zhihu.matisse.Matisse;
import com.zhihu.matisse.MimeType;
import com.zhihu.matisse.engine.impl.GlideEngine;
import com.zhihu.matisse.internal.entity.CaptureStrategy;

/**
 * Created by meijun on 18-1-9.
 */

public class MatisseUtils {

    private static String authority = "com.tongyi.lizhishop.fileprovider";

    public static void pickImage(Activity activity, int maxSelectable, int REQUEST_CODE_CHOOSE) {
        Matisse.from(activity)
                .choose(MimeType.allOf())
                .countable(true)
                .capture(true)
                .captureStrategy(new CaptureStrategy(true,authority))//存储到哪里
                .maxSelectable(maxSelectable)
                // .addFilter(new GifSizeFilter(320, 320, 5 * Filter.K * Filter.K))
                // .gridExpectedSize(getResources().getDimensionPixelSize(R.dimen.grid_expected_size))
                .restrictOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)
                .thumbnailScale(0.85f)
                .theme(R.style.Zhihu)
                .imageEngine(new GlideEngine())
                .forResult(REQUEST_CODE_CHOOSE);
    }
}
